<?php

class LoXienx3dot5 extends BaseLoDe
{

    function __construct()
    {
        $this->typeGame = Constant::GAME_LO_3DOT5_TYPE;
        $this->gameName = 'Lô X3.5';
        $this->rationMoney = 3.5;
    }
	
    function calculateGuareentyAmount()
    {
    	return $this->bet*3.5;
    }
    
    public function calculateWinMoney($ketquaXoSo)
    {
        $arrX3dot5 = json_decode($ketquaXoSo->x3dot5);
       // var_dump($arrX3dot5);
        // Ä�áº¿m táº§n sá»‘ xuáº¥t hiá»‡n cá»§a tá»«ng con lÃ´
        $arrFrequency = array_count_values($arrX3dot5);
        var_dump($arrFrequency);

        // á»¨ng vá»›i má»—i con lÃ´ vá»�, Ä‘Æ°á»£c tÃ­nh 1 láº§n
        $count = 0;
        foreach ($this->arrChoices as $choice)
        {
        	echo $choice.'<br/>';
            if (array_key_exists($choice, $arrFrequency))
            {
                $count += $arrFrequency[$choice];
            }
        }

        return $count * $this->bet/count($this->arrChoices) * $this->rationMoney;
    }

}

?>
